package sign.controller;


import mainpak.BitUtils;
import mainpak.URLRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import sign.dao.entity.IntelligentJudgeVO;
import sign.dao.entity.NewAdviceVO;
import sign.dao.entity.UserDataVO;
import sign.service.SignService;
import util.Log;

import java.util.ArrayList;
import java.util.List;

/**
 * @author GeChen
 * @Description 查询体征数据相关接口
 * @date 2019/5/8 11:36
 */
@RestController
@RequestMapping(value = "/api/Sign")
public class SignController {

    @Autowired
    private SignService signService;

    //根据用户id查询最新数据
    @RequestMapping(value = "/datas", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getCaptureDataByUserId(Integer userId) {
        Log.e(this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName());
        return signService.getCaptureDataByUserId(userId);
    }

    //根据用户id查询体征建议
    @RequestMapping(value = "/info", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getSignAndAdviceByCaptureData(@RequestBody UserDataVO userDataVO) {
        Log.e(this.getClass().getName(), Thread.currentThread().getStackTrace()[1].getMethodName());
        return signService.getSignAndAdviceByCaptureData(userDataVO);
    }

//    //提供给外界的接口
//    @RequestMapping(value = "/advice",method = RequestMethod.GET,produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
//    public String getAdvice(@RequestBody AdviceVO adviceVO){
//        return signService.getAdvice(adviceVO);
//    }

    // cjn - 提供给外界的接口
    // http://localhost:8080/SmartMachine/api/Sign/newAdvice
    @RequestMapping(value = "/advice", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getNewAdvice(@RequestBody NewAdviceVO newAdviceVO) {
        return signService.getNewAdvice(newAdviceVO);
    }

    //返回临床判断和医学建议
    // http://localhost:8080/SmartMachine/api/Sign/judge
    @RequestMapping(value = "/judge", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public String getJudgementAndAdvice(@RequestBody IntelligentJudgeVO intelligentJudgeVO){
        return signService.returnJudgementAndAdvice(intelligentJudgeVO);
    }


}
